import jsonpath

class GetKeyword:
    @staticmethod
    def get_keyword(source_data,keyword):
        try:
            return jsonpath.jsonpath(source_data,f'$..{keyword}')[0]
        except:
            print(f'关键字{keyword}不存在')
            return False
    @staticmethod

    def get_keywords(source_data,keyword):
        try:
            return jsonpath.jsonpath(source_data,f'$..{keyword}')
        except:
            print(f'关键字{keyword}不存在')
            return False

